﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MyVendorUsers.ascx.cs" Inherits="Gollie.Controls.MyVendorUsers" %>

<p class="title">Gebruikersbeheer</p>

 <script>
     function OpenPwDialog(userName) {
     	$G.web.dialog.show('resetVendorUserWW', { '#lblUserName': userName, '#tbhuid': $('#fldId').val(), '#tbhwt': $('#fldToken').val() });
     	return false;
     }

 </script>

<div style="padding-bottom: 16px; text-align: center;">
<a href="#" onclick="$G.web.dialog.show('registervendoruser');" class="button">Maak een nieuwe gebruiker</a>
</div>

<asp:HiddenField ID="fldId" ClientIDMode="Static" runat="server"/>
<asp:HiddenField ID="fldToken" ClientIDMode="Static" runat="server"/>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" ShowHeaderWhenEmpty="True" Width="100%" CellPadding="4" ForeColor="#333333" GridLines="None" DataKeyNames="UserId" HorizontalAlign="Center" OnRowCommand="GridView1_RowCommand" OnRowDataBound="GridView1_RowDataBound" AllowSorting="true" OnSorting="GridView1_Sorting">
     <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
    <Columns>
        <asp:TemplateField HeaderText="Bewerk">
            <ItemTemplate>
                <asp:ImageButton ID="btnEdit" runat="server" OnClientClick='<%#String.Concat("return OpenPwDialog(", "\"", Eval("UserName"), "\");") %>'
                    ImageUrl="~/Images/edit.png"
                    ToolTip="reset wachtwoord"
                    />
                <asp:ImageButton ID="btnDelete" runat="server"
                    ImageUrl="~/Images/delete.png"
                    ToolTip="Verwijderen"
                    CommandName="DeleteRow" 
                    CommandArgument='<%#String.Concat(Eval("UserId"), "|", ((GridViewRow) Container).RowIndex) %>'
                    OnClientClick="return confirm('U staat op het punt deze gebruiker te verwijderen.\r\n\r\nDoorgaan?');"
                    />
            </ItemTemplate>
            <HeaderStyle CssClass="offer-grid-header-quick" />
            <ItemStyle CssClass="offer-grid-cell-edit" />
        </asp:TemplateField>
        
        <asp:BoundField DataField="UserName" HeaderText="Gebruikersnaam" SortExpression="UserName">
         <HeaderStyle CssClass="offer-grid-header-quick" />
         <ItemStyle CssClass="offer-grid-cell-quick" />
        </asp:BoundField>

        <asp:BoundField DataField="RoleName" HeaderText="Functie" SortExpression="RoleName">
         <HeaderStyle CssClass="offer-grid-header-quick" />
         <ItemStyle CssClass="offer-grid-cell-quick" />
        </asp:BoundField>

        <asp:TemplateField HeaderText="Naam" SortExpression="LastName">
            <ItemTemplate>
                <asp:Label ID="Label1" runat="server" Text='<%# String.Concat(Eval("LastName"), " ", Eval("Infix"), ", ", Eval("Initials")) %>'></asp:Label>
            </ItemTemplate>
            <HeaderStyle CssClass="offer-grid-header-quick" />
            <ItemStyle CssClass="offer-grid-cell-quick" />
        </asp:TemplateField>

        <asp:BoundField DataField="LastLoginDate" DataFormatString="{0:dd-MMM-yyyy, HH:mm}" HeaderText="Laatst actief" SortExpression="LastLoginDate">
         <HeaderStyle CssClass="offer-grid-header" />
         <ItemStyle CssClass="offer-grid-cell" />
        </asp:BoundField>
    </Columns>
        <EditRowStyle BackColor="#999999" />
        <FooterStyle BackColor="#000000" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#000000" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#E9E7E2" />
        <SortedAscendingHeaderStyle BackColor="#506C8C" />
        <SortedDescendingCellStyle BackColor="#FFFDF8" />
        <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
</asp:GridView>
